import unittest
from src0716 import testbaidu1
from src0716 import testbaidu2

def createsuite():
    #addTest
    # suite = unittest.TestSuite()
    # suite.addTest(testbaidu1.Baidu1("test_hao"))
    # suite.addTest(testbaidu1.Baidu1("test_hbaidu"))
    # suite.addTest(testbaidu2.Baidu2("test_hao"))
    # suite.addTest(testbaidu2.Baidu2("test_baidusearch"))
    # return suite

    # makesuite
    # suite = unittest.TestSuite()
    # suite.addTest(unittest.makeSuite(testbaidu1.Baidu1))
    # suite.addTest(unittest.makeSuite(testbaidu2.Baidu2))
    # return suite

    #TestLoader
    # suite1 = unittest.TestLoader().loadTestsFromTestCase(testbaidu1.Baidu1)
    # suite2 = unittest.TestLoader().loadTestsFromTestCase(testbaidu2.Baidu2)
    # suite = unittest.TestSuite([suite1, suite2])
    # return suite

    #discover
     discover = unittest.defaultTestLoader.discover("../src0716", pattern="testbaidu*.py", top_level_dir=None)
     return discover
if __name__=="__main__":
    suite = createsuite()
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(suite)
